﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WuDada.Core.Post;
using WuDada.Core.Post.Service;
using WuDada.Core.Post.Domain;

public partial class developing : System.Web.UI.Page
{
    private PostFactory m_PostFactory;
    private IPostService m_PostService;

    //實體培訓課程
    private int m_NodeId = 32;

    protected void Page_Load(object sender, EventArgs e)
    {
        m_PostFactory = new PostFactory();
        m_PostService = m_PostFactory.GetPostService();

        if (!IsPostBack)
        {
            Dictionary<string, string> conditions = new Dictionary<string, string>();
            conditions.Add("NodeId", m_NodeId.ToString());
            conditions.Add("Flag", "1");

            Repeater1.DataSource = m_PostService.GetPostList(conditions);
            Repeater1.DataBind();
        }
    }

    protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemIndex != -1)
        {
            Control ctrl = e.Item;
            PostVO postVO = (PostVO)e.Item.DataItem;

            if (!string.IsNullOrEmpty(postVO.PicFileName))
            {
                UIHelper.SetContrlVisible(ref ctrl, "aLinkFile", true);
                UIHelper.SetHyperLinkNUrl(ref ctrl, "aLinkFile", string.Format("upload/{0}", postVO.PicFileName));
            }
        }
    }
}